package com.poul.acfun.ac_view.activity;

import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.design.widget.TabLayout;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.poul.acfun.R;
import com.poul.acfun.adapter.MainViewPagerAdapter;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {


    LinearLayout mainMenu;
    ImageView mainGame;
    ImageView mainDownload;
    ImageView mainHistory;
    ImageView mainSearch;
    TabLayout mainTab;
    ViewPager mainContainer;
    private NavigationView navigationView;
    private DrawerLayout drawer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Fresco.initialize(this);
        setContentView(R.layout.activity_main);
        mainMenu = (LinearLayout) findViewById(R.id.main_menu);
        mainTab = (TabLayout)findViewById(R.id.main_tab);
        mainContainer = (ViewPager)findViewById(R.id.main_container);
        navigationView = (NavigationView)findViewById(R.id.main_right_menu);
        drawer = (DrawerLayout)findViewById(R.id.activity_main);
        mainContainer.setAdapter(new MainViewPagerAdapter(getSupportFragmentManager(), this));
        mainTab.setupWithViewPager(mainContainer);
        mainMenu.setOnClickListener(this);
        mainContainer.setCurrentItem(1);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.main_menu:
                drawer.openDrawer(GravityCompat.START);
                break;
        }
    }
}
